﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

namespace Dora.Tools.Enums.Finance.Settlement
{
    public enum SettlementStatus
    {

        /// <summary>
        /// 已生成结算单
        /// </summary>
        [Description("已生成结算单")]
        Generated = 0,
        /// <summary>
        /// 待对账
        /// </summary>
        [Description("待对账")]
        NeedCheck = 2,
        /// <summary>
        /// 已对账
        /// </summary>
        [Description("已对账")]
        Checked = 4,
        /// <summary>
        /// 付款中
        /// </summary>
        [Description("付款中")]
        Paying = 6,
        /// <summary>
        /// 已完成
        /// </summary>
        [Description("已完成")]
        Completed = 8,
        /// <summary>
        /// 已作废
        /// </summary>
        [Description("已作废")]
        Invalidated = 10,
        /// <summary>
        /// 已拒绝
        /// </summary>
        [Description("已拒绝")]
        Refused = 12,
    }
    /// <summary>
    /// 
    /// </summary>
    public static class SettlementStatusExtension
    {
        /// <summary>
        /// 根据结算单状态判断结算单中的订单是否被释放
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static bool SettlementIsFree(this SettlementStatus state)
        {
            if (state == SettlementStatus.Completed
                || state == SettlementStatus.Invalidated
                || state == SettlementStatus.Refused
                )
            {
                return true;
            }
            return false;
        }
    }

}
